﻿@{
    Layout = "~/Views/Shared/_LayoutMember.cshtml";
    var type = ViewData["type"];
}

@model Domain.Model.User


@section HeadScript{
    <link href="~/Content/validBox/validBox.css" rel="stylesheet" />
    <script src="~/Content/validBox/validBox.js"></script>
    <link href="~/Content/window/window.css" rel="stylesheet" />
    <script src="~/Content/window/window.js"></script>
}
<form class="form-horizontal">
    <div class="fr2 green fs-25 Tbrline">信息安全->@ViewBag.title</div>

    @Html.Hidden("type",type)
    <div class="fr2">
        <div class="control-group">
            <label class="control-label" for="Name">旧密码</label>
            <div class="controls">
                @Html.Password("oldPassword")
            </div>
        </div>

        <div class="control-group">
            <label class="control-label" for="Name">新密码</label>
            <div class="controls">
                @Html.Password("newPassword")
            </div>
        </div>

        <div class="control-group">
            <label class="control-label" for="Name">确认新密码</label>
            <div class="controls">
                  @Html.Password("RePassword",null, Html.Valid().Required().EqualTo("newPassword", "两次密码不一致").AsHtmlAttribute())
            </div>
        </div>
        <div class="ui-row ui-row-sbtn">
            <input type="button" value="提   交" class="sbtn" onclick="saveForm()" />
        </div>
    </div>
</form>

@section Script{
    <script type="text/ecmascript">
        function saveForm() {
            $("form").validBox(function (r) {
                if (!r) return;
            });
            $.post("/member/changepassword", $("form").serialize(), function (data, textStatus) {
                if (data.state) {
                    window.messageBox("提示", "修改成功!", function () {
                    });
                }
                else {
                    window.messageBox("提示",data.value);
                }
                $(":password").val("");
            });
        }
    </script>
}
